package com.example.otpdemo2;

import com.warrenstrange.googleauth.GoogleAuthenticator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Hello world!
 */
@SpringBootApplication
public class App {

    private static String userSecurityString = "12345678";


    public static void main(String[] args) {
        System.out.println("Hello World!");


        SpringApplication.run(App.class);


    }

//    public static String createGoogleAuthQR(String secret, String account, String issuer) {
//        String qrCode = "otpauth://totp/%s?secret=%s&issuer=%s";
//        try {
//            return String.format(qrCode, URLEncoder.encode(issuer + ":" + account, "UTF-8").replace("+", "%20"),
//                    URLEncoder.encode(secret, "UTF-8").replace("+", "%20"),
//                    URLEncoder.encode(issuer, "UTF-8").replace("+", "%20"));
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        }
//        return "";
//    }
//
//    public static Integer getTOTP(String secretKey) {
//        GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator();
//        int pass = googleAuthenticator.getTotpPassword(secretKey);
//        return pass;
//    }
}
